﻿using MyCode.Project.Domain.Businesses.FileManager;
using MyCode.Project.Domain.Dtos.Request.Act;
using MyCode.Project.Domain.Message.Response.Common;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Enumeration;
using System;
using System.Collections.Generic;

namespace MyCode.Project.Services
{
    /// <summary>
    /// 文件管理器模块 相关服务
    /// </summary>
    public interface IFileManagerService 
    {
        /// <summary>
        /// 获取文件分页列表
        /// </summary>
        /// <param name="search">查询条件</param>
        /// <param name="merchantId">商家ID</param>
        /// <returns></returns>
        PageResult<FileInfo> GetPageList(PagedSearch<FileSearch> search, Guid merchantId);

        /// <summary>
        /// 保存文件
        /// </summary>k
        /// <param name="act">文件信息 操作</param>
        /// <param name="merchantId">商家ID</param>
        Guid Save(FileInfo act, Guid merchantId);

        /// <summary>
        /// 获取文件详情
        /// </summary>
        /// <param name="id">文件ID</param>
        /// <returns></returns>
        FileInfo GetDetial(Guid id);

        /// <summary>
        /// 保存文件组
        /// </summary>
        /// <param name="act">文件组 操作</param>
        /// <param name="merchantId">商家ID</param>
        void SaveGroup(List<FileGroupAct> act, Guid merchantId);

        /// <summary>
        /// 获取文件组下拉列表
        /// </summary>
        /// <param name="merchantId">商家ID</param>
        /// <returns></returns>
        List<ItemResult> GetGroupDropdownList(Guid merchantId);

        /// <summary>
        /// 获取文件组列表
        /// </summary>
        /// <param name="merchantId">商家ID</param>
        /// <returns></returns>
        List<FileGroupInfo> GetGroupList(Guid merchantId);

        /// <summary>
        /// 获取文件组统计列表
        /// </summary>
        /// <param name="merchantId">商家ID</param>
        /// <returns></returns>
        List<FileGroupCountInfo> GetGroupCountList(Guid merchantId);

        /// <summary>
        /// 保存关联文件
        /// </summary>
        /// <param name="fileUse">关联文件</param>
        /// <param name="dataId">数据ID</param>
        /// <param name="businessType">文件业务类型</param>
        /// <param name="merchantId">商家ID</param>
        void SaveUse(FileUse fileUse, Guid dataId, FileBusinessType businessType, Guid merchantId);

        /// <summary>
        /// 保存关联文件
        /// </summary>
        /// <param name="fileUses">关联文件集合</param>
        /// <param name="dataId">数据ID</param>
        /// <param name="businessType">文件业务类型</param>
        /// <param name="merchantId">商家ID</param>
        /// <param name="isMain">是否主文件,true:是,false:否</param>
        void SaveUse(List<FileUse> fileUses, Guid dataId, FileBusinessType businessType, Guid merchantId, bool isMain);

        /// <summary>
        /// 获取关联文件
        /// </summary>
        /// <param name="dataId">数据ID</param>
        /// <param name="businessType">文件业务类型</param>
        /// <returns></returns>
        FileUse GetUse(Guid dataId, FileBusinessType businessType);

        /// <summary>
        /// 获取关联文件列表
        /// </summary>
        /// <param name="dataId">数据ID</param>
        /// <param name="businessType">文件业务类型</param>
        /// <returns></returns>
        List<FileUse> GetUseList(Guid dataId, FileBusinessType businessType);

        /// <summary>
        /// 获取关联文件列表
        /// </summary>
        /// <param name="dataId">数据ID</param>
        /// <param name="businessType">文件业务类型</param>
        /// <returns></returns>
        List<FileUse> GetUseList(List<Guid> dataIds, FileBusinessType businessType);
    }
}
